﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace GigaSite.Web.Areas.ControlPanel.Controllers
{
    /// <summary>
    /// Корневой контроллер управления
    /// </summary>
    public class RootController : BaseRootController
    {
        //
        // GET: /ControlPanel/Root/
        /// <summary>
        /// Возвращает корневой контроллер панели управления
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// Возвращает структуру навигационного меню панели управления в виде JSON
        /// </summary>
        /// <returns>Json</returns>
        [HttpPost]
        public JsonResult GetNavMenu()
        {
            var menuItems = new List<Dictionary<string, object>>()
                                {
                                    // Статистическая информация
                                    new Dictionary<string, object>()
                                        {
                                            {"id", "stats"},
                                            {"leaf", true},
                                            {"text", "Статистическая информация"},
                                            {"url", "/ControlPanel/ViewStats/"},
                                            {"objectType", "section"}
                                        },
                                    // Статистическая информация
                                    new Dictionary<string, object>()
                                        {
                                            {"id", "homepage"},
                                            {"leaf", true},
                                            {"text", "Главная страница"},
                                            {"url", "/ControlPanel/ManageHomePage/"},
                                            {"objectType", "section"}
                                        },
                                    // Категории каталога
                                    new Dictionary<string, object>()
                                        {
                                            {"id", "categories"},
                                            {"leaf", true},
                                            {"text", "Категории"},
                                            {"url", "/ControlPanel/ManageCategories/"},
                                            {"objectType", "section"}
                                        },
                                    // Новости
                                    new Dictionary<string, object>()
                                        {
                                            {"id", "news"},
                                            {"leaf", true},
                                            {"text", "Новости"},
                                            {"url", "/ControlPanel/ManageNews/"},
                                            {"objectType", "section"}
                                        },
                                    // Визитки
                                    new Dictionary<string, object>()
                                        {
                                            {"id", "cards"},
                                            {"leaf", true},
                                            {"text", "Визитки"},
                                            {"url", "/ControlPanel/ManageCards/"},
                                            {"objectType", "section"}
                                        },
                                    // Сайты
                                    new Dictionary<string, object>()
                                        {
                                            {"id", "sites"},
                                            {"leaf", true},
                                            {"text", "Сайты"},
                                            {"url", "/ControlPanel/ManageSites/"},
                                            {"objectType", "section"}
                                        },
                                    // Объявления
                                    new Dictionary<string, object>()
                                        {
                                            {"id", "advs"},
                                            {"leaf", true},
                                            {"text", "Объявления"},
                                            {"url", "/ControlPanel/ManageAdvs/"},
                                            {"objectType", "section"}
                                        },
                                    // Торговые центры
                                    new Dictionary<string, object>()
                                        {
                                            {"id", "shoppingMalls"},
                                            {"leaf", true},
                                            {"text", "Торговые центры"},
                                            {"url", "/ControlPanel/ManageShoppingMalls/"},
                                            {"objectType", "section"}
                                        },
                                    // Организации
                                    new Dictionary<string, object>()
                                        {
                                            {"id", "companies"},
                                            {"leaf", true},
                                            {"text", "Компании"},
                                            {"url", "/ControlPanel/ManageCompanies/"},
                                            {"objectType", "section"}
                                        },
                                    // Пользователи
                                    new Dictionary<string, object>()
                                        {
                                            {"id", "users"},
                                            {"leaf", true},
                                            {"text", "Пользователи"},
                                            {"url", "/ControlPanel/ManageUsers/"},
                                            {"objectType", "section"}
                                        },
                                    // События
                                    new Dictionary<string, object>()
                                        {
                                            {"id", "events"},
                                            {"leaf", true},
                                            {"text", "События"},
                                            {"url", "/ControlPanel/ViewEvents/"},
                                            {"objectType", "section"}
                                        },
                                };
            return Json(menuItems);
        }
    }
}
